﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure.ServiceRuntime;

namespace BasicClasses
{
    public class AuxiliarMedicoDataSource
    {
        private static AuxiliarMedicoContext context = new AuxiliarMedicoContext();
        private static string tableName = RoleEnvironment.GetConfigurationSettingValue("AuxiliarMedicoTable");
        //private static string partitionName = RoleEnvironment.GetConfigurationSettingValue("MedicPartitionKey");

        public static IEnumerable<AuxiliarMedico> SelectAll()
        {
            return context.AuxiliaresMedicos;
        }

        public static void Add(AuxiliarMedico auxiliarMedico, string partitionKey) //partitionKey == Pais
        {
            auxiliarMedico.PartitionKey = partitionKey;
            auxiliarMedico.RowKey = Guid.NewGuid().ToString();
            context.AddObject(tableName, auxiliarMedico);
            context.SaveChanges();
        }

        //public static void DeleteAll()
        //{
        //    foreach (var medic in context.Medicos)
        //    {
        //        context.DeleteObject(medic);
        //    }

        //    context.SaveChanges();
        //}
    }
}
